{% load thumbnail %}
{% load highlight %}

<!--Body content-->

{% if goodies %}

{% if sum_pages %}
  Всего найдено <strong>{{sum_pages}}</strong> книг
{% endif %}


<!--highliter-->
<style type="text/css">
.highlighted {
  background-color: #ffbe28;
}

</style>
<!--/highliter-->

<!--Paginator-->
{% include 'goodies/paginator.html' %}
<!--Paginator-->


{% for book in goodies %}
<div class='container-fluid'>
  <div class='row-fluid'>
    <div class='span2'>
      {% if session.customer %}
      <a href="/basket/?add={{book.pk}}&next={{request.get_full_path}}" class="thumbnail">
      {% else %}
      <a href="#myModal" class="thumbnail" data-toggle="modal">
      {% endif %}
       {% thumbnail book.thumbnail_url "100x100" crop="center" as small %}
       <img src="{{small.url}}"  width="100%">
       <img src="/common/img/but/add3.gif" width='100%' alt="положить в корзину">
       {% endthumbnail %}
     </a>

   </div>

   <div class='span10'>

     <span class="zag"><a href="/book_item/?book_id={{book.pk}}">
      {% if keywords %}
        {% highlight book.name with keywords html_tag "span" class "highlighted"%}
      {% else %}
        {{book.name|truncatechars:100}}
      {% endif %} 
    </a></span>
    <br>


    <span class="author">
      {% if keywords %}
        {% highlight book.author with keywords html_tag "span" class "highlighted"%}
      {% else %}
        {{book.author}}
      {% endif %}

   </span>
   <br>
   <span class="search">
      {% if keywords %}
        {% highlight book.year with keywords html_tag "span" class "highlighted"%}
      {% else %}
        {{book.year}}
      {% endif %}



   </span>
   <br>
   <span >

      {% if keywords %}
        {% highlight book.description with keywords html_tag "span" class "highlighted"%}
      {% else %}
        {{book.description|truncatechars:200}}
      {% endif %}
   </span>
   <br>
   <img src="/common/img/bul/bul_1.gif"  alt="">
   {% if search_category_headings %}
     <a href="/book_item/?book_id={{book.pk}}&parent={{search_category_headings.0.0}}&child={{search_category_headings.1.0}}">Подробнее</a>
   {% else  %}
     <a href="/book_item/?book_id={{book.pk}}">Подробнее</a>
   {% endif %}

   <br>
   <img src="/common/img/zag/i_price.gif"  >
   <span class="price1">
      {% if keywords %}
        {% highlight book.price with keywords html_tag "span" class "highlighted"%}.00 руб.
      {% else %}
        {{book.price}}.00 руб.
      {% endif %}
    </span>
 </div>
</div>
</div><hr>
{% endfor %}

<!--Paginator-->

{% include 'goodies/paginator.html' %}


<!--/Paginator-->
{% else %}

  <p class='lead'>
  {% if keywords and suggestion  %}
    По запросу 
    <span class='text-error'>{{keywords}}</span> 
    ничего найти не удалось. Попробуйте
      <a style="font-size:20px;" href="?keywords={{suggestion}}">
      {{ suggestion }}
      </a>
    
  {% else %}
    Извините, но мы ничего не нашли. Попробуйте дополнить, или изменить запрос
  {% endif %}
  </p>

{% endif %}
<!--/Body content-->